<?php
class Comment extends CI_Controller{
     public function __construct(){
        parent::__construct();
        $this->load->helper("url");
        $this->load->Model("MComment");
    }

    public function addComments(){
        $cm_Name = $_REQUEST["cm_Name"];
        $cm_Content = $_REQUEST["cm_Content"];
        $cm_Email = $_REQUEST["cm_Email"];
        $cm_Id = $_REQUEST["cm_Id"];
        $cm_Product_Id = $_REQUEST["cm_Product_Id"];
        $cm_IsMember = $_REQUEST["cm_IsMember"];
        $cm_isLogin = $_REQUEST["cm_isLogin"];

        $data = array(
           'cm_Name'        => $cm_Name,
           'cm_Content'     => $cm_Content,
           'cm_Email'       => $cm_Email,
           'cm_Id'          => $cm_Id,
           'cm_Product_Id'  => $cm_Product_Id,
           'cm_IsMember'    => $cm_IsMember,
           'cm_isLogin'     => $cm_isLogin
        );
        $this->MComment->insert($data);

        $data['comments'] = $this->MComment->get_CommnetById($cm_Product_Id); 
        $this->load->view('frontend/ajax_Comment', $data);
    }

    public function getFormComments() {
        $this->load->view('frontend/ajax_Form_Comment');
    }
}
?>